package com.api.gbhg.lbj.api;

import com.alibaba.fastjson.JSONObject;
import com.api.gbhg.lbj.dao.ExcelDao;
import com.api.gbhg.lbj.tool.Tools;
import com.api.gbhg.lbj.util.ExcelBizHelper;
import com.api.gbhg.lbj.util.ExpenditureDetail;
import com.api.gbhg.lbj.util.ProExpPertargetFromDetail;
import com.api.gbhg.lbj.util.ProExpPertargetImpmonDetail;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import weaver.general.BaseBean;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.soa.workflow.request.*;
import weaver.workflow.workflow.WorkflowVersion;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;

/**
 * @author lbj
 * @version 1.0
 * @description: TODO 导入excel
 * @date 2021/1/27 11:30
 */
@Path("/gbhg/excelV2")
public class ImportExcelApiV2 extends BaseBean {
    private static final Logger logger = LoggerFactory.getLogger("gbhg");

    @POST
    @Path("/importV2")
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    public String getExcel(Map<String,String> param){
    //public String getExcel(Map<String,String> param){
        logger.info("进入上传导入总署项目excle方法--");
        Integer fileId = Integer.parseInt(param.get("file"));
        //User user = HrmUserVarify.getUser(request, response);//当前登录用户
        User user = new User(13939);
        String uid = String.valueOf(user.getUID());//获取用户id
        String year="("+Tools.getCurrentYear()+"年度"+")";
        logger.info(",fileId:"+fileId);
        ExcelDao excelDao=new ExcelDao();
        Map<String, Object> data = excelDao.getSheet1Data(fileId);//sheetname--项目基本信息
        Map<String, Object> data2 = excelDao.getSheet2Data(fileId);//sheetname--项目支出立项依据
        Map<String, Object> data3 = excelDao.getSheet3Data(fileId);//sheetname--项目支出实施方案
        Map<String, Object> data6 = excelDao.getSheet6Data(fileId);//sheetname--项目支出绩效目标申报表
        Map<String, Object> data7 = excelDao.getSheet7Data(fileId);//sheetname--项目支出绩效目标执行监控
        Map<String, Object> data8 = excelDao.getSheet8Data(fileId);//sheetname--项目支出绩效自评表
        Map<String, Object> data9 = excelDao.getSheet9Data(fileId);//sheetname--部门项目评审报告
        String workflowid = getPropValue("FormationWorkflowid", "BZ18Workflowid");//读取配置文件
        String activeWFID = WorkflowVersion.getActiveVersionWFID(workflowid);
        logger.info("activeWFID--:"+activeWFID);
//        写
//        ImageFileManager imageFileManager = new ImageFileManager();
//        imageFileManager.setImagFileName(name);
//        imageFileManager.setData(data);
//        int fileId = imageFileManager.saveImageFile();
        RequestInfo requestinfo = new RequestInfo();
        requestinfo.setCreatorid(uid);//创建者ID
        requestinfo.setWorkflowid(activeWFID); // 工作流ID 92:通用项目表
        requestinfo.setRequestlevel("0"); // 紧急程度:0正常，1重要，2紧急
        requestinfo.setRemindtype("1"); // 提醒类型
        requestinfo.setIsNextFlow("0");//不自动流转至下一节点
        requestinfo.setDescription(data.get("xmmc").toString()+ TimeUtil.getCurrentTimeString());//标题

        //logger.info("MainTableInfo-----");
        MainTableInfo table = new MainTableInfo();
        table.addProperty(getPro("cjr",uid));//创建人
        table.addProperty(getPro("cjrq",TimeUtil.getCurrentDateString()));//创建日期
        table.addProperty(getPro("cjrks",Tools.getDepartmentId(uid)));//创建人科室
        table.addProperty(getPro("cjrdw", Tools.getsubcompanyId(uid)));//创建人单位
//        table.addProperty(getPro("jbr", ""));//经办人
//        table.addProperty(getPro("bbdw", ""));//编报单位
//        table.addProperty(getPro("sydw", ""));//使用单位
//        table.addProperty(getPro("yxysswy", ""));//一下预算数(万元)

        table.addProperty(getPro("sheet1_main_field1",  data.get("ssyjxm").toString()));//所属一级项目
        table.addProperty(getPro("sheet1_main_field2",  data.get("kmdm").toString()));//科目代码
        table.addProperty(getPro("sheet1_main_field3",  data.get("sbdw").toString()));//项目单位
        table.addProperty(getPro("sheet1_main_field4",  data.get("xmdm").toString()));//项目代码
        table.addProperty(getPro("sheet1_main_field5",  data.get("xmmc").toString()));//项目名称
        table.addProperty(getPro("sheet1_main_field6",  data.get("xmlb").toString()));//项目类别
        table.addProperty(getPro("sheet1_main_field67", data.get("jjsx").toString()));//基建属性
        table.addProperty(getPro("sheet1_main_field8",  data.get("jhkszxnf").toString()));//计划开始执行年份
        table.addProperty(getPro("sheet1_main_field9",  data.get("xmzq").toString()));//项目周期
        table.addProperty(getPro("sheet1_main_field10", Util.null2String(data.get("zxpfnf").toString())));//最新批复年份
        table.addProperty(getPro("sheet1_main_field11", data.get("mj").toString()));//密级
        table.addProperty(getPro("sheet1_main_field12", data.get("bmqxdw").toString()));//保密期限单位
        table.addProperty(getPro("sheet1_main_field13", data.get("bmqx").toString()));//保密期限
        table.addProperty(getPro("sheet1_main_field14", data.get("sfkyxm").toString()));//是否科研项目
        table.addProperty(getPro("sheet1_main_field15", data.get("fzr").toString()));//项目负责人
        table.addProperty(getPro("sheet1_main_field16", data.get("zw").toString()));//职务
        table.addProperty(getPro("sheet1_main_field17", data.get("lxdh").toString()));//联系人电话
        table.addProperty(getPro("sheet1_main_field18", data.get("sfhxbs").toString()));//是否横向标识
        table.addProperty(getPro("sheet1_main_field19", data.get("czshzt").toString()));//财政审核状态
        table.addProperty(getPro("sheet1_main_field20", data.get("sfbssbczk").toString()));//是否标识上报财政库
        table.addProperty(getPro("sheet1_main_field21", data.get("dkbs").toString()));//打捆标识

        table.addProperty(getPro("sheet2_main_field1", data2.get("xmmc").toString()));//项目名称
        table.addProperty(getPro("sheet2_main_field2", data2.get("xmdw").toString()));//项目单位
        table.addProperty(getPro("sheet2_main_field3", data2.get("zgdwjdm").toString()));//主管单位及代码
        table.addProperty(getPro("sheet2_main_field4", data2.get("xmlb").toString()));//项目类别
        table.addProperty(getPro("sheet2_main_field5", data2.get("xmksnf").toString()));//项目开始年份
        table.addProperty(getPro("sheet2_main_field6", data2.get("xmzq").toString()));//项目周期
        table.addProperty(getPro("sheet2_main_field7", data2.get("xmzclxyj").toString()));//项目支出立项依据

        table.addProperty(getPro("sheet3_main_field1", data3.get("xmmc").toString()));//项目名称
        table.addProperty(getPro("sheet3_main_field2", data3.get("xmdw").toString()));//项目单位
        table.addProperty(getPro("sheet3_main_field3", data3.get("zgdwjdm").toString()));//主管单位及代码
        table.addProperty(getPro("sheet3_main_field4", data3.get("xmlb").toString()));//项目类别
        table.addProperty(getPro("sheet3_main_field5", data3.get("xmksnf").toString()));//项目开始年份
        table.addProperty(getPro("sheet3_main_field6", data3.get("xmzq").toString()));//项目周期
        table.addProperty(getPro("sheet3_main_field7", data3.get("xmzcssfa").toString()));//项目支出实施方案
//
//logger.info("data6:"+data6);
        table.addProperty(getPro("sheet6_main_field1", data6.get("xmmc").toString()));//项目名称
        table.addProperty(getPro("sheet6_main_field2", data6.get("zgbmjdm").toString()));//主管部门及代码
        table.addProperty(getPro("sheet6_main_field3", data6.get("ssdw").toString()));//实施单位
        table.addProperty(getPro("sheet6_main_field4", data6.get("xmsx").toString()));//项目属性
        table.addProperty(getPro("sheet6_main_field5", data6.get("xmzq").toString()));//项目周期
        table.addProperty(getPro("sheet6_main_field6", data6.get("zqzjze").toString()));//中期资金总额：
        table.addProperty(getPro("sheet6_main_field7", data6.get("zqqzczbk").toString()));//财政拨款-中期
        table.addProperty(getPro("sheet6_main_field8", data6.get("zqsnjzzj").toString()));//上年结转资金-中期
        table.addProperty(getPro("sheet6_main_field9", data6.get("zqqtzj").toString()));//其他资金-中期
        table.addProperty(getPro("sheet6_main_field11", data6.get("ndzjze").toString()));//年度资金总额：
        table.addProperty(getPro("sheet6_main_field12", data6.get("ndqzczbk").toString()));//财政拨款-年度
        table.addProperty(getPro("sheet6_main_field13", data6.get("ndsnjzzj").toString()));//上年结转资金-年度
        table.addProperty(getPro("sheet6_main_field14", data6.get("ndqtzj").toString()));//其他资金-年度
        table.addProperty(getPro("sheet6_main_field10", data6.get("zqmb").toString()));//中期目标
        table.addProperty(getPro("sheet6_main_field15", data6.get("ndmb").toString()));//年度目标
        table.addProperty(getPro("sheet6_year_1",year));//年度
//        logger.info("-------11111111111111111111------------");
//logger.info("data7:"+data7);
        table.addProperty(getPro("sheet7_main_field1", data7.get("xmmc").toString()));//项目名称
        table.addProperty(getPro("sheet7_main_field2", data7.get("zgbmjdm").toString()));//主管部门及代码
        table.addProperty(getPro("sheet7_main_field3", data7.get("ssdw").toString()));//实施单位
        table.addProperty(getPro("sheet7_main_field4", data7.get("ncyss1").toString()));//年初预算数1
        table.addProperty(getPro("sheet7_main_field5", data7.get("ncyss2").toString()));//年初预算数2
        table.addProperty(getPro("sheet7_main_field6", data7.get("ncyss3").toString()));//年初预算数3
        table.addProperty(getPro("sheet7_main_field7", data7.get("ncyss4").toString()));//年初预算数4
        table.addProperty(getPro("sheet7_main_field8", data7.get("zxs1").toString()));//1-7月执行数1
        table.addProperty(getPro("sheet7_main_field9", data7.get("zxs2").toString()));//1-7月执行数2
        table.addProperty(getPro("sheet7_main_field10", data7.get("zxs3").toString()));//1-7月执行数3
        table.addProperty(getPro("sheet7_main_field11", data7.get("zxs4").toString()));//1-7月执行数4
        table.addProperty(getPro("sheet7_main_field12", data7.get("zxl1").toString()));//1-7月执行率1
        table.addProperty(getPro("sheet7_main_field13", data7.get("zxl2").toString()));//1-7月执行率2
        table.addProperty(getPro("sheet7_main_field14", data7.get("zxl3").toString()));//1-7月执行率3
        table.addProperty(getPro("sheet7_main_field15", data7.get("zxl4").toString()));//1-7月执行率4
        table.addProperty(getPro("sheet7_main_field16", data7.get("qnzxs1").toString()));//全年预计执行数1
        table.addProperty(getPro("sheet7_main_field17", data7.get("qnzxs2").toString()));//全年预计执行数2
        table.addProperty(getPro("sheet7_main_field18", data7.get("qnzxs3").toString()));//全年预计执行数3
        table.addProperty(getPro("sheet7_main_field19", data7.get("qnzxs4").toString()));//全年预计执行数4
        table.addProperty(getPro("sheet7_main_field20", data7.get("ndztmb").toString()));//年度总体目标
        table.addProperty(getPro("sheet7_year_2", year));//年度
//
        //logger.info("data8:"+data8);
        table.addProperty(getPro("sheet8_main_field1", data8.get("xmmc").toString()));//项目名称
        table.addProperty(getPro("sheet8_main_field2", data8.get("zgbm").toString()));//主管部门
        table.addProperty(getPro("sheet8_main_field3", data8.get("ssdw").toString()));//实施单位
        table.addProperty(getPro("sheet8_main_field4", data8.get("ncyss1").toString()));//年初预算数1
        table.addProperty(getPro("sheet8_main_field5", data8.get("ncyss2").toString()));//年初预算数2
        table.addProperty(getPro("sheet8_main_field6", data8.get("ncyss3").toString()));//年初预算数3
        table.addProperty(getPro("sheet8_main_field7", data8.get("ncyss4").toString()));//年初预算数4
        table.addProperty(getPro("sheet8_main_field8", data8.get("qnyss1").toString()));//全年预算数1
        table.addProperty(getPro("sheet8_main_field9", data8.get("qnyss2").toString()));//全年预算数2
        table.addProperty(getPro("sheet8_main_field10", data8.get("qnyss3").toString()));//全年预算数3
        table.addProperty(getPro("sheet8_main_field11", data8.get("qnyss4").toString()));//全年预算数4
        table.addProperty(getPro("sheet8_main_field12", data8.get("qnzxs1").toString()));//全年执行数1
        table.addProperty(getPro("sheet8_main_field13", data8.get("qnzxs2").toString()));//全年执行数2
        table.addProperty(getPro("sheet8_main_field14", data8.get("qnzxs3").toString()));//全年执行数3
        table.addProperty(getPro("sheet8_main_field15", data8.get("qnzxs4").toString()));//全年执行数4
        table.addProperty(getPro("sheet8_main_field16", data8.get("fz1").toString()));//分值1
        table.addProperty(getPro("sheet8_main_field17", data8.get("fz2").toString()));//分值2
        table.addProperty(getPro("sheet8_main_field18", data8.get("fz3").toString()));//分值3
        table.addProperty(getPro("sheet8_main_field19", data8.get("fz4").toString()));//分值4
        table.addProperty(getPro("sheet8_main_field20", data8.get("zxl1").toString()));//执行率1
        table.addProperty(getPro("sheet8_main_field21", data8.get("zxl2").toString()));//执行率2
        table.addProperty(getPro("sheet8_main_field22", data8.get("zxl3").toString()));//执行率3
        table.addProperty(getPro("sheet8_main_field23", data8.get("zxl4").toString()));//执行率4
        table.addProperty(getPro("sheet8_main_field24", data8.get("df1").toString()));//得分1
        table.addProperty(getPro("sheet8_main_field25", data8.get("df2").toString()));//得分2
        table.addProperty(getPro("sheet8_main_field26", data8.get("df3").toString()));//得分3
        table.addProperty(getPro("sheet8_main_field27", data8.get("df4").toString()));//得分4
        table.addProperty(getPro("sheet8_main_field28", data8.get("yqmb").toString()));//预期目标
        table.addProperty(getPro("sheet8_main_field29", data8.get("sjwcqk").toString()));//实际完成情况
        table.addProperty(getPro("sheet8_year_3", year));//年度
//
        //logger.info("data9:"+data9);
        table.addProperty(getPro("sheet9_main_field1", data9.get("xmmc").toString()));//项目名称
        table.addProperty(getPro("sheet9_main_field2", data9.get("xmdw").toString()));//项目单位
        table.addProperty(getPro("sheet9_main_field3", data9.get("zgdwjdm").toString()));//主管单位及代码
        table.addProperty(getPro("sheet9_main_field4", data9.get("xmlb").toString()));//项目类别
        table.addProperty(getPro("sheet9_main_field5", data9.get("xmksnf").toString()));//项目开始年份
        table.addProperty(getPro("sheet9_main_field6", data9.get("xmzq").toString()));//项目周期
        table.addProperty(getPro("sheet9_main_field7", data9.get("psfs").toString()));//评审方式
        table.addProperty(getPro("sheet9_main_field8", data9.get("zjpsjg").toString()));//中介评审机构
        table.addProperty(getPro("sheet9_main_field9", data9.get("psnr").toString()));//评审内容
        table.addProperty(getPro("sheet9_year_4", year));//年度
        requestinfo.setMainTableInfo(table);
//

        List<ExcelBizHelper> exceData = excelDao.getExceSheet4(fileId);//项目支出计划
        List<ExpenditureDetail> exceSheet5 = excelDao.getExceSheet5(fileId);//项目支出明细
        List<ProExpPertargetFromDetail> exceSheet6 = excelDao.getExceSheet6(fileId);//项目支出绩效目标申报表
        List<ProExpPertargetImpmonDetail> exceSheet7 = excelDao.getExceSheet7(fileId);//项目支出绩效目标执行监控表
        List<ProExpPertargetImpmonDetail> exceSheet8 = excelDao.getExceSheet8(fileId);//项目支出绩效自评表
        //logger.info("exceData---:"+exceData+",exceData.size():"+exceData.size());
        DetailTableInfo tables = new DetailTableInfo();
        DetailTable OneTable = new DetailTable();
        DetailTable TwoTable = new DetailTable();
        DetailTable ThreeTable = new DetailTable();
        DetailTable FourTable = new DetailTable();
        DetailTable FiveTable = new DetailTable();
        OneTable.setId("2");//表示明细表2
        TwoTable.setId("3");//表示明细表3
        ThreeTable.setId("4");//表示明细表4
        FourTable.setId("5");//表示明细表5
        FiveTable.setId("6");//表示明细表6
       // logger.info("exceData-----项目支出计划:"+exceData);
        if (exceData.size()!=0) {
            for (int i = 0; i < exceData.size(); i++) {//明细表行数
                Row row = new Row();
                String deptBudget = exceData.get(i).getDeptBudget();
                if (StringUtils.isNotBlank(deptBudget)) {
                    deptBudget = deptBudget.substring(deptBudget.indexOf("[") + 1, deptBudget.indexOf("]"));
                }
                String governmentBudget = exceData.get(i).getGovernmentBudget();
                if (StringUtils.isNotBlank(governmentBudget)) {
                    governmentBudget = governmentBudget.substring(governmentBudget.indexOf("[") + 1, governmentBudget.indexOf("]"));
                }
               // logger.info("部门预算支出经济分类Tools.getuf_jjzcflkmkId(deptBudget)"+Tools.getuf_jjzcflkmkId(deptBudget));
                //logger.info("对应政府经济支出分类Tools.getuf_jjzcflkmkId(deptBudget)"+Tools.getuf_jjzcflkmkId(governmentBudget));

                row.addCell(getCell("sheet4_detail2_field1", exceData.get(i).getYear()));//预算年度
                row.addCell(getCell("sheet4_detail2_field2", Tools.getuf_jjzcflkmkId(deptBudget)));//部门预算支出经济分类
                row.addCell(getCell("sheet4_detail2_field3", exceData.get(i).getSubtotal()));//合计(元)
                row.addCell(getCell("sheet4_detail2_field4", exceData.get(i).getCe()));//差额(元)
                row.addCell(getCell("sheet4_detail2_field5", exceData.get(i).getTzq()));//调整前数(元)
                row.addCell(getCell("sheet4_detail2_field6", exceData.get(i).getTzh()));//调整后数(元)
                row.addCell(getCell("sheet4_detail2_field7", Tools.getuf_jjzcflkmkId(governmentBudget)));//对应政府经济支出分类
                row.addCell(getCell("sheet4_detail2_field8", exceData.get(i).getCarryforwardfunds()));//结转资金
                row.addCell(getCell("sheet4_detail2_field9", exceData.get(i).getJysfapzc()));//教育收费安排支出
                row.addCell(getCell("sheet4_detail2_field10", exceData.get(i).getQtzj()));//其他资金
                OneTable.addRow(row);
                //logger.info("部门预算支出经济分类:"+deptBudget+",对应政府经济分类:"+governmentBudget);
            }
        }
        if (exceSheet5.size()!=0) {
            for (int i = 0; i < exceSheet5.size(); i++) {
                Row row = new Row();
                String priceStandard = exceSheet5.get(i).getPriceStandard();
                if (StringUtils.isBlank(priceStandard)) {
                    priceStandard = "0.00";
                }
                String expenditurePlan = exceSheet5.get(i).getExpenditurePlan();
                if (StringUtils.isBlank(expenditurePlan)) {
                    expenditurePlan = "0.00";
                }
                row.addCell(getCell("sheet5_detail_field1", exceSheet5.get(i).getProjectActivities()));//项目活动
                row.addCell(getCell("sheet5_detail_field2", exceSheet5.get(i).getProjectActivitiesDescribe()));//对项目活动的描述
                row.addCell(getCell("sheet5_detail_field3", exceSheet5.get(i).getSubActivity()));//子活动
                row.addCell(getCell("sheet5_detail_field4", exceSheet5.get(i).getSubActivityDescribe()));//对子活动的描述
                row.addCell(getCell("sheet5_detail_field5", exceSheet5.get(i).getItemizedExpenditure()));//分项支出
                row.addCell(getCell("sheet5_detail_field6", exceSheet5.get(i).getQuantityFrequency()));//数量/频率
                row.addCell(getCell("sheet5_detail_field7", priceStandard));//价格/标准
                row.addCell(getCell("sheet5_detail_field8", expenditurePlan));//支出计划（万元）
                row.addCell(getCell("sheet5_detail_field9", exceSheet5.get(i).getRemarks()));//备注
                TwoTable.addRow(row);
            }
        }
        if (exceSheet6.size()!=0) {
            for (int i = 0; i < exceSheet6.size(); i++) {
                Row row = new Row();
                String id = "";
                String id2 = "";
                String indexvalue = exceSheet6.get(i).getIndexvalue();
                logger.info("ImportExcelApi>>sheet6>"+ JSONObject.toJSONString(exceSheet6.get(i)));
                logger.info("ImportExcelApi>>sheet6>"+ indexvalue);
                String indexvalue2 = indexvalue.substring(1);//指标值
                indexvalue = indexvalue.substring(0, 1);//指标属性
                switch (indexvalue) {
                    case ">":
                        id = "0";
                        break;
                    case "<":
                        id = "1";
                        break;
                    case "≥":
                        id = "2";
                        break;
                    case "≤":
                        id = "3";
                        break;
                    default:
                        id = "4";
                        indexvalue2 = exceSheet6.get(i).getIndexvalue();
                }
                String indexvalue3 = exceSheet6.get(i).getIndexvalue2();
                String indexvalue4 = indexvalue3.substring(1);//指标值
                indexvalue3 = indexvalue3.substring(0, 1);//指标属性
                logger.info("indexvalue3指标属性:" + indexvalue3);
                switch (indexvalue3) {
                    case ">":
                        id2 = "0";
                        break;
                    case "<":
                        id2 = "1";
                        break;
                    case "≥":
                        id2 = "2";
                        break;
                    case "≤":
                        id2 = "3";
                        break;
                    default:
                        id2 = "4";
                        indexvalue4 = exceSheet6.get(i).getIndexvalue2();
                }
                row.addCell(getCell("sheet6_detail1_field1", exceSheet6.get(i).getFirstlevelindicators()));//一级指标
                row.addCell(getCell("sheet6_detail1_field2", exceSheet6.get(i).getSecondaryindicators()));//二级指标
                row.addCell(getCell("sheet6_detail1_field3", exceSheet6.get(i).getThirdlevelindicators()));//三级指标
                row.addCell(getCell("sheet6_detail1_field4", id));//指标属性
                row.addCell(getCell("sheet6_detail1_field5", indexvalue2));//指标值
                row.addCell(getCell("sheet6_detail1_field6", exceSheet6.get(i).getSecondaryindicators2()));//二级指标
                row.addCell(getCell("sheet6_detail1_field7", exceSheet6.get(i).getThirdlevelindicators2()));//三级指标
                row.addCell(getCell("sheet6_detail1_field8", indexvalue4));//指标值
                row.addCell(getCell("sheet6_detail1_field9", id2));//指标属性
                ThreeTable.addRow(row);
            }
        }
        if (exceSheet7.size()!=0) {
            for (int i = 0; i < exceSheet7.size(); i++) {
                Row row = new Row();
                row.addCell(getCell("sheet7_detail1_field1", exceSheet7.get(i).getFirstlevelindicators()));//一级指标
                row.addCell(getCell("sheet7_detail1_field2", exceSheet7.get(i).getSecondaryindicators()));//二级指标
                row.addCell(getCell("sheet7_detail1_field3", exceSheet7.get(i).getThirdlevelindicators()));//三级指标
                row.addCell(getCell("sheet7_detail1_field4", exceSheet7.get(i).getAnnualindexvalue()));//年度指标值
                row.addCell(getCell("sheet7_detail1_field5", exceSheet7.get(i).getImplementation()));//1-7月执行情况
                row.addCell(getCell("sheet7_detail1_field6", exceSheet7.get(i).getExpectedcompletionyear()));//全年预计完成情况
                row.addCell(getCell("sheet7_detail1_field7", exceSheet7.get(i).getFundguarantee()));//经费保障
                row.addCell(getCell("sheet7_detail1_field8", exceSheet7.get(i).getSystemguarantee()));//制度保障
                row.addCell(getCell("sheet7_detail1_field9", exceSheet7.get(i).getPersonnelsupport()));//人员保障
                row.addCell(getCell("sheet7_detail1_field10", exceSheet7.get(i).getHardwareconditionguarantee()));//硬件条件保障
                row.addCell(getCell("sheet7_detail1_field11", exceSheet7.get(i).getOther()));//其他
                row.addCell(getCell("sheet7_detail1_field12", exceSheet7.get(i).getReasons()));//原因说明
                row.addCell(getCell("sheet7_detail1_field13", exceSheet7.get(i).getSure()));//确定能
                row.addCell(getCell("sheet7_detail1_field14", exceSheet7.get(i).getBeonthecards()));//有可能
                row.addCell(getCell("sheet7_detail1_field15", exceSheet7.get(i).getImpossible()));//完全不可能
                row.addCell(getCell("sheet7_detail1_field16", exceSheet7.get(i).getRemarks()));//备注
                FourTable.addRow(row);
            }
        }
        //logger.info("exceSheet8:"+exceSheet8);
        if (exceSheet8.size()!=0) {
            for (int i = 0; i < exceSheet8.size(); i++) {
                Row row = new Row();
                row.addCell(getCell("sheet8_detail1_field1", exceSheet8.get(i).getFirstlevelindicators()));//一级指标
                row.addCell(getCell("sheet8_detail1_field2", exceSheet8.get(i).getSecondaryindicators()));//二级指标
                row.addCell(getCell("sheet8_detail1_field3", exceSheet8.get(i).getThirdlevelindicators()));//三级指标
                row.addCell(getCell("sheet8_detail1_field4", exceSheet8.get(i).getAnnualindexvalue()));//年度指标值
                row.addCell(getCell("sheet8_detail1_field5", exceSheet8.get(i).getActualcompletionvalue()));//实际完成值
                row.addCell(getCell("sheet8_detail1_field6", exceSheet8.get(i).getScore()));//分值
                row.addCell(getCell("sheet8_detail1_field7", exceSheet8.get(i).getScore2()));//得分
                row.addCell(getCell("sheet8_detail1_field8", exceSheet8.get(i).getDeviationcauseanalysis()));//偏差原因分析及改进措施
                FiveTable.addRow(row);
            }
        }
        tables.addDetailTable(OneTable);
        tables.addDetailTable(TwoTable);
        tables.addDetailTable(ThreeTable);
        tables.addDetailTable(FourTable);
        tables.addDetailTable(FiveTable);
        requestinfo.setDetailTableInfo(tables);
        RequestService requestService  = new RequestService();
        String requestid = "";
        try {
            requestid = requestService.createRequest(requestinfo);
        } catch (Exception e) {
            e.printStackTrace();
            logger.info(e.getMessage());
        }
        logger.info("ImportExcelApi流程创建成功="+requestid);
        return requestid;
    }
    public Property getPro(String field,String value) {
        Property property = new Property();
        property.setName(field);
        property.setValue(value);
        return property;
    }

    public Cell getCell(String field,String value) {
        Cell cel = new Cell();
        cel.setName(field);
        cel.setValue(value);
        return cel;
    }

}
